﻿<custom:TabPageControl x:Class="MIXer.Views.RenamerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:cal="http://www.caliburnproject.org"
             xmlns:custom="clr-namespace:MIXer.Customization">
    <DockPanel LastChildFill="True">
        
        <Grid DockPanel.Dock="Top" Margin="10 10 10 10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock Text="Videos folder:" VerticalAlignment="Center" Grid.Column="0" Padding="10 5 10 5" />
            <TextBox x:Name="FolderLocation" Grid.Column="1" Margin="5 5 5 5" />
            <Button x:Name="OpenFolderDialog" Content="Choose" Padding="10 5 10 5" Margin="5 5 5 5" Grid.Column="2" />
            <Button x:Name="GetFiles" Content="Get files" Padding="10 5 10 5" Margin="5 5 5 5" Grid.Column="3" />
        </Grid>

        <Grid DockPanel.Dock="Bottom" Margin="10 10 10 10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <StackPanel Orientation="Horizontal" Grid.Column="0">
                <TextBlock Text="These files are from" Padding="10 5 10 5" VerticalAlignment="Center" />
                <ComboBox x:Name="Events" Margin="5 5 5 5" Width="120"
                          cal:Message.Attach="[Event SelectionChanged] = [Action EventSelectionChanged(Events.SelectedItem)]">
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <Border Padding="2 2 2 2">
                                <TextBlock Text="{Binding EventFriendlyName}" />
                            </Border>
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <TextBlock Text="Name format:" Padding="10 5 10 5" VerticalAlignment="Center" />
                <TextBox x:Name="NameFormat" Margin="5 5 5 5" Width="120" />
                <TextBlock Text="Available tokens:" Padding="10 5 10 5" VerticalAlignment="Center" />
                <TextBlock x:Name="AvailableTokens" Margin="5 5 5 5" VerticalAlignment="Center" FontWeight="Bold" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" Grid.Column="1">
                <Button x:Name="DeSelectAll" Content="Deselect all" Padding="10 5 10 5" Margin="5 5 5 5" />
                <Button x:Name="SelectAll" Content="Select all" Padding="10 5 10 5" Margin="5 5 5 5" />
                <Button x:Name="RenameFiles" Content="Rename" Padding="10 5 10 5" Margin="5 5 5 5" />
            </StackPanel>
        </Grid>

        <Grid Margin="10 10 10 10">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <ListBox x:Name="Files" Grid.Column="0" Grid.Row="0">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Padding="10 10 10 10" cal:Bind.Model="{Binding}">
                            <StackPanel Orientation="Horizontal">
                                <CheckBox x:Name="IsSelected" VerticalAlignment="Center"
                                          cal:Message.Attach="[Event Checked] = [Action FileCheckChanged($dataContext)]; [Event Unchecked] = [Action FileCheckChanged($dataContext)]" />
                                <TextBlock x:Name="FullName" Margin="5 0 0 0" VerticalAlignment="Center" />
                            </StackPanel>
                        </Border>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <TextBlock  FontSize="11" FontStyle="Italic" Foreground="Red" Grid.Column="0" Grid.Row="1"
                Text="The rename is only supported when the file name corresponds to the session code" />
        </Grid>
    </DockPanel>
</custom:TabPageControl>
